package com.powerManager.sdk.utils;

import java.io.IOException;
import java.lang.reflect.Method;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.powerManager.sdk.handlers.RoleHandler;
import com.powerManager.sdk.web.RequestProcess;

public class AjaxUtil{
	
	/** 
	* <p>Title: invokeMethod</p> 
	* <p>Description: 根据传入对象，自动执行对象方法</p> 
	* @param request
	* @param response
	* @return 
	*/ 
	public Object invokeMethod(HttpServletRequest request, HttpServletResponse response){
		RequestProcess rp = new RequestProcess();
		//获取提交路径
		String type = request.getParameter("type");
		
		//获取类名的方法名
		String methodName = request.getParameter("method");
		System.out.println("方法名称："+methodName);
		//方法参数
		String[] args = new String[]{};
		try {
			return rp .doProcess(request, response, type, args);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "";
	}
}
